# -*- coding: utf-8 -*-
# @CreateTime    : 2020/8/06
# @Author  : jiyu
# @Email   : 57296141@qq.com
# @File    : Login.py
# @Company: Nanjing-Anyuan
from openpyxl import load_workbook
import openpyxl


class yunyingribao(object):
    #        self.wb=load_workbook("C:\\01.工作需求\\杨帆总需求\\运营日报模板-test.xlsx")
    def tuiguang(enterprise, data):
        wb = load_workbook("C:\\01.工作需求\\杨帆总需求\\运营日报模板-test.xlsx")
        ws = wb['推广']
        yonghuweb = {'zhonghuanantonggang': 'L10', 'zhonghuayangzhou': 'X10', 'zhonghuatianjin': 'AJ10',
                     'zhonghuadongfang': 'AV10', 'zhonghuazhuhai': 'L28', 'zhoushanguochu': 'X28',
                     'zhonghuaxinghai': 'AJ28', 'yingjijidi': 'AV28', }
        yonghuphone = {'zhonghuanantonggang': 'L11', 'zhonghuayangzhou': 'X11', 'zhonghuatianjin': 'AJ11',
                       'zhonghuadongfang': 'AV11', 'zhonghuazhuhai': 'L29', 'zhoushanguochu': 'X29',
                       'zhonghuaxinghai': 'AJ29', 'yingjijidi': 'AV29', }
        stationweb = yonghuweb[enterprise]
        stationphone = yonghuphone[enterprise]
        ws[stationweb] = data[0]  # 推广写入web用户数据
        ws[stationphone] = data[1]  # 推广写入手机端用户数据
        wb.save("C:\\01.工作需求\\杨帆总需求\\运营日报模板-test.xlsx")
        wb.close()

    def tuiguangyonghuzengliang(enterprise, data):
        wb = load_workbook("C:\\01.工作需求\\杨帆总需求\\运营日报模板-test.xlsx")
        ws = wb['推广']
        hse = {'zhonghuanantonggang': 'I54', 'zhonghuayangzhou': 'X54', 'zhonghuatianjin': 'AM54',
               'zhonghuadongfang': 'I63', 'zhonghuazhuhai': 'X63', 'zhoushanguochu': 'AM63', 'zhonghuaxinghai': 'I71',
               'yingjijidi': 'X71', }
        cm = {'zhonghuanantonggang': 'I55', 'zhonghuayangzhou': 'X55', 'zhonghuatianjin': 'AM55',
              'zhonghuadongfang': 'I64', 'zhonghuazhuhai': 'X64', 'zhoushanguochu': 'AM64', 'zhonghuaxinghai': 'I72',
              'yingjijidi': 'X72', }
        yingji = {'zhonghuanantonggang': 'I56', 'zhonghuayangzhou': 'X56', 'zhonghuatianjin': 'AM56',
                  'zhonghuadongfang': 'I65', 'zhonghuazhuhai': 'X65', 'zhoushanguochu': 'AM65',
                  'zhonghuaxinghai': 'I73', 'yingjijidi': 'X73', }
        yuanfa = {'zhonghuanantonggang': 'I57', 'zhonghuayangzhou': 'X57', 'zhonghuatianjin': 'AM57',
                  'zhonghuadongfang': 'I66', 'zhonghuazhuhai': 'X66', 'zhoushanguochu': 'AM66',
                  'zhonghuaxinghai': 'I74', 'yingjijidi': 'X74', }
        stationhse = hse[enterprise]
        stationcm = cm[enterprise]
        stationyingji = yingji[enterprise]
        stationyuanfa = yuanfa[enterprise]
        ws[stationhse] = data[0]
        ws[stationcm] = data[3]
        ws[stationyingji] = data[1]
        ws[stationyuanfa] = data[4]
        wb.save("C:\\01.工作需求\\杨帆总需求\\运营日报模板-test.xlsx")
        wb.close()

    def shangxianyonghuzengliang_nantong(data):
        wb = load_workbook("C:\\01.工作需求\\杨帆总需求\\运营日报模板-test.xlsx")
        ws = wb['上线']
        hse = 'M29'
        yingji = 'M30'
        oa = 'M31'
        cm = 'M32'
        yuanfa = 'M33'
        yewu = 'M35'
        cangdan = 'M36'
        ws[oa] = data[2]
        ws[yewu] = data[5]
        ws[cangdan] = data[6]
        wb.save("C:\\01.工作需求\\杨帆总需求\\运营日报模板-test.xlsx")
        wb.close()

    def shangxianyonghuzengliang_zhoushan(data):
        wb = load_workbook("C:\\01.工作需求\\杨帆总需求\\运营日报模板-test.xlsx")
        ws = wb['上线']
        hse = 'M29'
        yingji = 'M30'
        oa = 'M31'
        cm = 'M32'
        yuanfa = 'M33'
        yewu = 'M35'
        cangdan = 'M36'
        ws[hse] = data[0]
        ws[cm] = data[3]
        ws[yingji] = data[1]
        ws[yuanfa] = data[4]
        wb.save("C:\\01.工作需求\\杨帆总需求\\运营日报模板-test.xlsx")
        wb.close()

    def shangxian(enterprise, data):
        wb = load_workbook("C:\\01.工作需求\\杨帆总需求\\运营日报模板-test.xlsx")
        ws = wb['上线']
        yonghuweb = {'zhonghuanantonggang': 'L11', 'zhonghuazhoushan': 'X11'}
        yonghuphone = {'zhonghuanantonggang': 'L12', 'zhonghuazhoushan': 'X12'}
        stationweb = yonghuweb[enterprise]
        stationphone = yonghuphone[enterprise]
        ws[stationweb] = data[0]  # 推广写入web用户数据
        ws[stationphone] = data[1]  # 推广写入手机端用户数据
        wb.save("C:\\01.工作需求\\杨帆总需求\\运营日报模板-test.xlsx")
        wb.close()

    def nuodong(row1, row2, col1, col2):
        wb = load_workbook("C:\\01.工作需求\\杨帆总需求\\运营日报模板-test.xlsx")
        ws = wb['推广']
        a=[]
        num=0
        for row in range(row1, row2+1):
            for col in range(col1, col2+1):
                a.append(ws.cell(row, col).value)
        for rownew in range(row1, row2+1):
            for colnew in range(col1-1, col2):
                ws.cell(rownew, colnew).value=a[num]
                num=num+1
        wb.save("C:\\01.工作需求\\杨帆总需求\\运营日报模板-test.xlsx")
    def nuodongsx(row1, row2, col1, col2):
        wb = load_workbook("C:\\01.工作需求\\杨帆总需求\\运营日报模板-test.xlsx")
        ws = wb['上线']
        a=[]
        num=0
        for row in range(row1, row2+1):
            for col in range(col1, col2+1):
                a.append(ws.cell(row, col).value)
        for rownew in range(row1, row2+1):
            for colnew in range(col1-1, col2):
                ws.cell(rownew, colnew).value=a[num]
                num=num+1
        wb.save("C:\\01.工作需求\\杨帆总需求\\运营日报模板-test.xlsx")